package com.leap.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Builder
@TableName("comment")
@Schema(description = "评论类对象")
public class Comment {

    //雪花算法
    @Schema(description = "主键id")
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Schema(description = "评论的用户id")
    @TableField("account_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long accountId;

    @Schema(description = "回复的评论id")
    @TableField("answer_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long answerId;

    @Schema(description = "频道id")
    @TableField("channel_id")
    private int channelId;

    @Schema(description = "评论内容")
    @TableField("content")
    private String content;

    @Schema(description = "点赞数")
    @TableField("like_count")
    private int likeCount;

    @Schema(description = "评论类型")
    @TableField("type")
    private int type;

    @TableField(value = "create_time",fill = FieldFill.INSERT )
    @Schema(description = "评论时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    private LocalDateTime createTime;



}
